﻿#pragma once

#include <WinSock2.h>
#include "Protocol.h"

typedef struct Client Client;

typedef void(*ClientDelete)(Client*);
typedef ResultCode(*ClientAddFriend)(Client*, LPCTSTR);
typedef void(*ClientAllowAddFriend)(Client*, BOOL, const AddFriendRequest*);
typedef void(*ClientChat)(Client*, const ChatInfo*);
typedef void(*ClientLogoff)(Client*);
typedef void(*ClientLogon)(Client*, LPCTSTR, LPCTSTR);
typedef void(*ClientReg)(Client*, LPCTSTR, LPCTSTR, int);

// 客户端
struct Client {
    HWND mCallback;     // 回调
    int mFriendCount;   // 好友数
    int mIconIndex;     // 头像索引
    SOCKET mSocket;     // 套接字

    ClientDelete deleteSelf;
    ClientAddFriend addFriend;
    ClientAllowAddFriend allowAddFriend;
    ClientChat chat;
    ClientLogoff logoff;
    ClientLogon logon;
    ClientReg reg;
};

Client* New_Client(HWND);
